package cn;



import java.io.FileInputStream;
import java.io.FileOutputStream;

public class FileTest1 {

    public static void main(String[] args) throws Exception{
        long time3=System.nanoTime();
        FileInputStream fis=new FileInputStream("1.pdf");
        FileOutputStream fos=new FileOutputStream("1.pdf",true);
        //FileOutputStream()后面加true指文件后面可追加

        int b;
        while((b=fis.read())!=-1){
            fos.write(b);
        }
        fis.close();//一定记得关闭流，养成好习惯
        fos.close();
        long time4=System.nanoTime();
        System.out.printf("运行时间为%d纳秒",(time4-time3));
    }
}